﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PortConfigValidValues.cs" company="R.V.Kasner">
//   Copyright © 2011 R.V.Kasner
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Owen.Terminal.ViewModel
{
    using System.Collections.Generic;
    using System.IO.Ports;

    using Owen.Communication.Serial;

    public sealed class PortConfigValidValues
    {
        private static PortConfigValidValues def;

        public static PortConfigValidValues Default
        {
            get
            {
                return def ??
                       (def =
                        new PortConfigValidValues
                            {
                                BaudRateEnum =
                                    new[] { 600, 1200, 2400, 4800, 9600, 14400, 28800, 19200, 38400, 56000, 57600, 115200, }, 
                                DataBitsEnum =
                                    new[] { DataBits.Five, DataBits.Six, DataBits.Seven, DataBits.Eight, DataBits.Nine }, 
                                HandshakeEnum =
                                    new[]
                                        {
                                            Handshake.None, Handshake.RequestToSend, Handshake.RequestToSendXOnXOff, 
                                            Handshake.XOnXOff
                                        }, 
                                ParityEnum = new[] { Parity.Even, Parity.Mark, Parity.None, Parity.Odd, Parity.Space }, 
                                StopBitsEnum =
                                    new[] { StopBits.None, StopBits.One, StopBits.OnePointFive, StopBits.Two }
                            });
            }
        }

        public IEnumerable<int> BaudRateEnum { get; set; }

        public IEnumerable<DataBits> DataBitsEnum { get; set; }

        public IEnumerable<Handshake> HandshakeEnum { get; set; }

        public IEnumerable<Parity> ParityEnum { get; set; }

        public IEnumerable<StopBits> StopBitsEnum { get; set; }
    }
}